package com.hexinfo.dmpro.script.pack.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

@AllArgsConstructor
public enum FileScanEnum {

    INIT_FILE_SUFFIX1("_alter.sql", "初始化脚本文件后缀"),
    INIT_FILE_SUFFIX2("_create.sql", "初始化脚本文件后缀"),
    INIT_FILE_SUFFIX3("_drop.sql", "初始化脚本文件后缀"),
    INIT_FILE_SUFFIX4("_init.sql", "初始化脚本文件后缀"),
    INIT_FILE_SUFFIX5("_trade.sql", "初始化脚本文件后缀"),
    FILE_NAME_REGULAR("^[a-z|A-Z|0-9|_]+", "文件名称正则规则"),

    HQL_SUFFIX(".hql", "hive脚本文件后缀"),

    INIT("init", "初始化脚本"),
    INIT_SHELL("init_shell", "初始化Shell脚本"),
    SERVICE("service", "下载、推送、稽核脚本"),
    PERIOD("period", "周期脚本"),
    PERIOD_SHELL("period_shell", "周期Shell脚本"),
    HIVE_SQL("hive_sql", "Hive的sql脚本"),

    CREATE("create", "建表"),

    ALTER("alter", "修改表"),

    DROP("drop", "删除表"),

    STRING("STRING", "STRING字段类型"),

    DECIMAL("DECIMAL", "DECIMAL字段类型"),

    PARTITION("dk_system_of_sdata", "指定源分区"),

    PARTITION_TYPE("STRING", "指定源分区字段类型"),

    PARTITION_COMMENT("'源分区'", "指定源分区备注"),

    DISTINCT("DISTINCT", "DISTINCT语句"),

    PARAMS_PRE("${var:schema_", "库名参数化前缀"),

    PARAMS_SUF("}", "库名参数化后缀"),

    COMPUTE_CHECK("computeCheck", "统计表操作"),

    REFRESH_CHECK("refreshCheck", "刷新表操作"),

    SET_ENV_CHECK("setEnvCheck", "set环境配置检查"),

    IP_CHECK("ipCheck", "检查sql中是否存在明文ip"),

    SHELL_FILE_TYPE_CHECK("shellFileTypeCheck", "shell脚本类型检查");


    @Getter
    private final String value;

    @Getter
    private final String desc;

    public static List<String> getValues() {
        return Arrays.stream(FileScanEnum.values()).map(FileScanEnum::getValue).collect(Collectors.toList());
    }
}
